package com.atguigu.service.impl;

import com.atguigu.mapper.OaProcessTemplateMapper;
import com.atguigu.mapper.OaProcessTypeMapper;
import com.atguigu.model.process.ProcessTemplate;
import com.atguigu.model.process.ProcessType;
import com.atguigu.service.OaProcessTemplateService;
import com.atguigu.service.OaProcessTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OaProcessTypeServiceImpl extends ServiceImpl<OaProcessTypeMapper, ProcessType> implements OaProcessTypeService {
    @Autowired
    private OaProcessTemplateService oaProcessTemplateService;
    @Override
    public List<ProcessType> findProcessType() {
        List<ProcessType> processTypeList = baseMapper.selectList(null);
        for (ProcessType processType : processTypeList) {
          List<ProcessTemplate> processTemplateList=  oaProcessTemplateService.findTemplateByTypeId(processType.getId());
          processType.setProcessTemplateList(processTemplateList);
        }
        return processTypeList;
    }
}
